19 August 2020

Main scripts:
	NONPARAMETRIC_ANALYSIS.do
	NONPARAMETRIC_ANALYSIS_ONLINE_APPENDIX.do
	MLE_ANALYSIS.m
	
Data file: 
	data_reflection_horp.xlsx

Auxiliary files:
	mle_overall.m
	mle_mixedrisk.m
	mle_mixedrisk_rsc.m
	mle_reflection.m
	mle_reflection_rsc.m
	mle_reflection_con.m

+-------------------------------------------+
| General                                   |
+-------------------------------------------+

Opening the scripts NONPARAMETRIC_ANALYSIS.do and NONPARAMETRIC_ANALYSIS_ONLINE_APPENDIX.do and executing reproduces the non-parametric analyses reported in, respectively, the paper 'The reflection effect for higher order risk preferences' (Sections 4.1 and 4.2) and its Online Appendix. Running the script MLE_ANALYSIS.m reproduces the results reported in Section 4.3 and 4.4 of the paper. Results are reported in the same order as in the main text of the paper/the Online Appendix. 

Running the scripts requires the data file and all the auxiliary files (in the case of MLE_ANALYSIS.m) to be in the working directory. The second sheet of the data file contains the codebook.

The scripts were run with stata/SE 15.1, respectively MATLAB R2019a on Windows 10.

+-------------------------------------------+
| NONPARAMETRIC_ANALYSIS.do                 |
+-------------------------------------------+

This script reproduces the non-parametric analysis reported in the paper. It first calculates the proportion of risk apportionment responses for each risk order and each treatment and performs a binomial test (Table 1). Next, it performs a Wilcoxon signed rank test for each treatment and risk order to test the reflection effect. This is followed by Spearman rank correlations between the risk order and the consistency of responses, and average consistencies for the 50-50 and small probability gains data and Mann-Whitney U tests for the differences between these consistencies. The calculation of average responses per task (Table 6) concludes the results from Section 4.1. 
Next, the results from Secton 4.2 are reproduced. The Spearman rank correlations between the risk apportionment choices for the three risk orders (Table 2) are estimated followed by the frequency tables and Fisher's exact tests.

By uncommenting line 8 the same analysis can be performed on the data from the original sessions (as discussed in Section 1 of the Online Appendix).

+-------------------------------------------+
| NONPARAMETRIC_ANALYSIS_ONLINE_APPENDIX.do |
+-------------------------------------------+

This script reproduces the non-parametric analysis reported in the Online Appendix. It first estimates the difference between the percentage choices of the risk apportionment option for the original and the replication data, and performs Mann Whitney U tests for differences between the original and replication data. This is followed by various ordered probit regressions and related average marginal effects to test for the effect of background characteristics on choices (Table 1 to 5). The Kruskal-Wallis test for session effects (Table 6) is then performed. Finally, ANOVA is estimated to test for ordering effects.

N.b. the analysis of the data from the original sessions mentioned in Section 1 of the Online Appendix can be performed with NONPARAMETRIC_ANALYSIS.do by uncommenting line 8.

+-------------------------------------------+
| MLE_ANALYSIS.m                            |
+-------------------------------------------+

This script reproduces the Maximum Likelihood values reported in the paper. 

First, the parameter values for different higher order risk attitudes are estimated, and likelihood ratios computed with the restriction that the proportion of subjects with preferences that satisfy risk apportionment is equal to the proportion of subjects with the opposite attitude (restriction lambda_s = lambda_o). This part uses the script mle_overall.m for the log likelihood function to maximise.

Next, the proportion of subjects with the various combinations of second and fourth order risk preferences are estimated. This part uses the scripts mle_mixedrisk.m and mle_mixedrisk_rsc.m, the latter for the restricted log likelihood. The displayed numbers indicate, respectively, the proportion of subjects who are risk averse and temperate; risk averse and temperance neutral; risk averse and intemperate; risk neutral and temperate; etc, followed by the error rates. These are followed by the computed log likelihood ratios, with the restricion that lambda_ss + lambda_oo = lambda_so + lambda_os.

Finally, log likelihood ratios are calculated to test the reflection effect, that is, with the restriction that the number of subjects who satisfy risk apportionment relative to the number of subjects with the opposite attitude for a given gain treatment is equal to the same ratio for the loss treatment (restriction lambda_s(l)/lambda_o(l) = lambda_s(g)/lambda_o(g)). This part uses the scripts mle_reflection.m and mle_reflection_rsc.m, the latter for the restricted log likelihood, and mle_reflection_con.m for the constraint.

By uncommenting line 9 the same analysis can be performed on the data from the original sessions (as discussed in Section 1 of the Online Appendix).

+-------------------------------------------+
| data_reflection_horp.xlsx                 |
+-------------------------------------------+

This file contains the data recorded in the experiment. A codebook is provided on the second sheet.

+-------------------------------------------+
| mle_overall.m                             |
+-------------------------------------------+

This is a log likelihood function (probability mass function) and takes absolute frequencies of the number of choices made by subjects for the options indicating risk apportionment choices as its input.

+-------------------------------------------+
| mle_mixedrisk.m                           |
+-------------------------------------------+

This is a log likelihood function (probability mass function) and takes the number of choices made by an individual subject for the options indicating risk apportionment as its input.

+-------------------------------------------+
| mle_mixedrisk_rsc.m                       |
+-------------------------------------------+

This is a log likelihood function (probability mass function) and takes the number of choices made by an individual subject for the options indicating risk apportionment as its input, with the restriction that that lambda_ss + lambda_oo = lambda_so + lambda_os (in the script: that ss + oo = so + os). This restriction is substituted into the log likelihood function.

+-------------------------------------------+ 
| mle_reflection.m                          |
+-------------------------------------------+

This is a log likelihood function (probability mass function) and takes absolute frequencies of the number of choices made by subjects for the options indicating risk apportionment choices for losses and gains as its input.

+-------------------------------------------+
| mle_reflection_rsc.m                      |
+-------------------------------------------+

This is a log likelihood function (probability mass function) and takes absolute frequencies of the number of choices made by subjects for the options indicating risk apportionment choices for losses and gains as its input. It is the same as mle_reflection.m, except that is rescaled to ensure convergence.

+-------------------------------------------+
| mle_reflection_con.m                      |
+-------------------------------------------+

This is the nonlinear constraint (lambda_s(l)/lambda_o(l) = lambda_s(g)/lambda_o(g)) for the restricted log likelihood testing the reflection effect.